import request from '@/utils/request'

/**
 * 获取楼宇列表
 * @param { page, pageSize} params
 * @returns
 */
export function getCardListAPI(params) {
    return request({
        url: '/parking/card/list',
        params
    })
}

/**
 * 新增月卡
 * @data
 * @returns
 */
export function createCardAPI(data) {
    return request({
        url: '/parking/card',
        method: 'POST',
        data
    })
}

/**
 * 获取月卡详情
 * @data
 * @returns
 */
export function getCardDetailAPI(id) {
    return request({
        url: `/parking/card/detail/${id}`
    })
}


/**
 * 修改月卡
 * @data
 * @returns
 */
export function updateCardAPI(data) {
    return request({
        url: '/parking/card/edit',
        method: 'PUT',
        data
    })
}

/**
 * 单个删除月卡
 * @param {*} id
 * @returns
 */
export function delCardAPI(id) {
    return request({
        url: `/parking/card/${id}`,
        method: 'DELETE'
    })
}

/**
 * 批量删除月卡
 * @param {*} id
 * @returns
 */
export function delCardListAPI(idList) {
    return request({
        url: `/parking/card/${idList.join(',')}`,
        method: 'DELETE'
    })
}



//计费规则管理
/**
 * 获取规则列表
 * @param { page, pageSize} params
 * @returns
 */
export function getRuleListAPI(params) {
    return request({
        url: 'parking/rule/list',
        params
    })
}

/**
 * 创建规则：提交新增的计费规则
 * @returns
 */
export function createRuleAPI(data) {
    return request({
        url: '/parking/rule',
        method: 'POST',
        data
    })
}